﻿<Window x:Class="LockCrypt.WinImport"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:props="clr-namespace:LockCrypt.Properties"
    xmlns:lex="http://schemas.root-project.org/xaml/presentation"
    xmlns:loc="clr-namespace:LockCrypt"
    xmlns:l49ui="clr-namespace:Lime49.UI;assembly=Lime49"
    xmlns:l49="clr-namespace:Lime49;assembly=Lime49"
    xmlns:l49loc="clr-namespace:Lime49.UI"
    Title="{lex:LocText LockCrypt.Core:Strings:Import}" Style="{StaticResource {x:Type Window}}" Icon="/LockCrypt;component/Resources/LockCrypt.ico"
    Height="300" Width="450" MinHeight="200" MinWidth="350" MaxHeight="450" MaxWidth="500" SizeToContent="Height"
    WindowStartupLocation="CenterOwner" x:Name="root" 
    l49:WindowService.EscapeClosesWindow="True">
    <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Close" Executed="CloseWindow" />
        <CommandBinding Command="NavigationCommands.NextPage" Executed="StartImport" />
    </Window.CommandBindings>
    <Window.Resources>
        <props:Settings x:Key="settings" />
    </Window.Resources>
    <Grid Margin="6" DataContext="{StaticResource settings}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" SharedSizeGroup="labels" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <l49loc:FilePicker Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" x:Name="filenameChooser"
                                LabelText="{lex:LocText LockCrypt.Core:Strings:Filename}"
                                PathHistoryKey="ImportHistory"
                                IsSaveDialog="False"
                                SelectedPath="{Binding ElementName=root,Path=FileName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                DialogTitle="{lex:LocText LockCrypt.Core:Strings:SaveDescriptorAs}"/>

        <Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Top" Content="{lex:LocText LockCrypt.Core:Strings:Type}"/>
        <ListBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" x:Name="lstType" Style="{StaticResource RadioListTemplate}" DisplayMemberPath="Value" SelectedValuePath="Key"
                      SelectedValue="{Binding ElementName=root,Path=FileType,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" SelectionChanged="lstType_SelectionChanged" />
        <Label Grid.Row="3" Grid.Column="0" Content="{lex:LocText LockCrypt.Core:Strings:EncryptionAlgorithm}"/>
        <ComboBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" x:Name="cboEncryption" TabIndex="4" DisplayMemberPath="Value" SelectedValuePath="Key"
                  SelectedValue="{Binding ElementName=root,Path=EncryptionAlgorithm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>

        <StackPanel Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button HorizontalAlignment="Right" MinWidth="70" IsDefault="True"  Command="NavigationCommands.NextPage" Content="{lex:LocText LockCrypt.Core:Strings:Import}"/>
            <Button HorizontalAlignment="Right" MinWidth="70" IsCancel="True" Command="ApplicationCommands.Close" Content="{lex:LocText LockCrypt.Core:Strings:Cancel}"/>
        </StackPanel>
    </Grid>
</Window>
